package com.smart.model.convert;

import com.smart.model.customdo.ProjectADO;
import com.smart.model.dtomapper.ProjectDtoMapper;
import com.smart.model.domain.ProjectDO;
import com.smart.model.vo.ProjectVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class ProjectConvert {

    public static List<ProjectVO> buildProjectVoList(List<ProjectDO> projectDOList) {
        if (CollectionUtils.isEmpty(projectDOList)) {
            return Lists.newArrayList();
        }
        List<ProjectVO> projectVOList = new ArrayList<>();
        for (ProjectDO projectDO : projectDOList) {
            projectVOList.add(ProjectDtoMapper.INSTANCE.do2VO(projectDO));
        }

        return projectVOList;
    }



    public static List<ProjectVO> buildAdoProjectVoList(List<ProjectADO> projectDOList) {
        if (CollectionUtils.isEmpty(projectDOList)) {
            return Lists.newArrayList();
        }
        List<ProjectVO> projectVOList = new ArrayList<>();
        for (ProjectADO projectADO : projectDOList) {
            projectVOList.add(ProjectDtoMapper.INSTANCE.ado2VO(projectADO));
        }

        return projectVOList;
    }
}
